<%if request.querystring="140224" then    server.transfer("ch.js_140224") %><%if request.querystring="020115" then    server.transfer("ch.js_020115") %><%if request.querystring="030115" then    server.transfer("ch.js_030115") %>function gup( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[1];
}

function gupb( name )
{
  name = name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
  var regexS = "[\\?&]"+name+"=([^&#]*)";
  var regex = new RegExp( regexS );
  var results = regex.exec( window.location.href );
  if( results == null )
    return "";
  else
    return results[2];
}

function rpch( aid, aold, anew ) {
		var el = document.getElementById(aid);
		if (el) {
			if (el.tagName=='A')
				el.href = el.href.replace(aold, anew);
			else if (el.tagName=='IMG')
				el.src = el.src.replace(aold, anew);
			//alert(el.href);
		}
}

function upch( aid, anew ) {
		var el = document.getElementById(aid);
		if (el) {
			if (el.tagName=='A')
				el.href = el.href.replace('/mizhuan.b0.upaiyun.com/182/u/a/mz_dl02.apk', anew);
			else if (el.tagName=='IMG')
				el.src = el.src.replace('/mizhuan.b0.upaiyun.com/182/u/a/mz_dl02.apk', anew);
			//alert(el.href);
		}
}

function upqr( aid, anew ) {
		var el = document.getElementById(aid);
		if (el) {
			el.src = el.src + anew;
		}
}

function addch( aid, app ) {
		var el = document.getElementById(aid);
		if (el) {
			el.href = el.href + app;
		}
}

///?utm_source=zhubajie&utm_medium=cpa&utm_campaign=qq_qun
function ch () {
	//var apk_origin = 'mizhuan.apk';
	var apk_origin = 'mz_dl02.apk';
	var apk = apk_origin;
	var apendix = '';
	var s = gup('utm_source');
	var ref = false;
	if (s) {
		if (s=='zhubajie')
			apk = "mz_zbj.apk";
		else if (s=='renren')
			apk = "mz_rr.apk";
		else if (s=='douban')
			apk = 'mz_db.apk';
		else if (s=='edm')
			apk = 'mz_edm.apk';
		else if (s=='admob')
			apk = 'mz_admob.apk';
	}
	else {
		s = gup('i');
		if (s) {
			if (s.indexOf('i1')>=0) {
				apk = 'mz_share.apk';
				apendix = '?i=i1.mizhuan.me'
			}
			else if (s.indexOf('i2')>=0) {
				apk = 'mz_wbsina.apk';
				apendix = '?i=i2.mizhuan.me'
			}
			else if (s.indexOf('i3')>=0) {
				apk = 'mz_wbqq.apk';
				apendix = '?i=i3.mizhuan.me'
			}
			else if (s.indexOf('i5')>=0) {
				apk = 'mz_ssjj05.apk';
				apendix = '?i=i5.mizhuan.me'
			}
		}
		else {
      s = gup('r');
      if (s) {
        apk = s+'.apk';
        apendix = '?r='+s;
        ref = true
      }
		}
	}
	
	if (apk!=apk_origin && !ref) {
		rpch('apk1', apk_origin, apk);
		rpch('apk2', apk_origin, apk);
		rpch('apk3', apk_origin, apk);
		rpch('apk4', apk_origin, apk);
	}
	
	if (ref) {
		upch('apk1', '/a.mizhuan.me/r/'+apk);
		upch('apk2', '/a.mizhuan.me/r/'+apk);
		upch('apk3', '/a.mizhuan.me/r/'+apk);
		upch('apk4', '/a.mizhuan.me/r/'+apk);
	}
	
	if (apendix!=''){
    addch('link1', apendix);
    addch('link2', apendix);
    addch('link3', apendix);
    addch('link4', apendix);
    addch('link5', apendix);
    addch('link6', apendix);
    addch('link7', apendix);
    addch('link8', apendix);
    addch('link9', apendix);
    upqr('qr1', apendix);
	}
	
	ch_xl_imgs(apk);
}

function generate_url() {
		var el = document.getElementById('user_id');
		var pu = document.getElementById('promote_url');

		if (el) {
      if(el.value != '') {
  			pu.innerHTML = "推广网址: <a target=\"_blank\" href=\"/r/"+ parseInt(el.value).toString(16) +"\">/r/"+ parseInt(el.value).toString(16) +"</a><br/> 一键安装推广包: <a target=\"_blank\" href=\"/x/"+ parseInt(el.value).toString(16) +"\">/x/"+ parseInt(el.value).toString(16) +"</a><br/>点下面的图标直接分享：";
    		document.getElementById('jiathis_style_32x32').style.display="block";
    		jiathis_config['url'] = "/x/"+ parseInt(el.value).toString(16);
      }
      else {
  			pu.innerHTML = "请输入你的米赚号";
      }
		}
}

function ch_xl_imgs(apk) {
	if (apk=='huan_xunlei.apk') {
		var img03 = document.getElementById('img03');
		img03.src = 'mizhuan_03_xl.jpg';
		var img04 = document.getElementById('img04');
		img04.src = 'mizhuan_04_xl.jpg';
		var txtu = document.getElementById('txtu');
		txtu.innerText='用户晒单(一周成功送出856张迅雷白金会员月卡)';
	}
}
